package com.xk.springboot.controller;

import com.xk.springboot.pojo.Member;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * @author:Teacher黄
 * @date:Created at 2020/04/09
 */

@Controller
@RequestMapping("/thy")
public class ThymeleafController {

    @GetMapping("/home")
    public String index(Model model){
        // 转发数据到 页面?
        model.addAttribute("name","李小平通知");
        // 构造一个集合
        List<Member> members = new ArrayList<>();
        members.add(new Member("平哥1","东莞",18));
        members.add(new Member("平哥2","东莞",19));
        members.add(new Member("平哥3","东莞",17));
        members.add(new Member("平哥4","东莞",12));
        model.addAttribute("members",members);
        // 发送一个数字
        model.addAttribute("count",10);

        return "index";
    }


}
